<template>
	<view class="all-main">
		<view class="main">
			<view class="list" v-if="data !== undefined && data!== null && data.length>0">
				<view class="items" v-for="(item,index) in data" :key="index">
					<view class="top">
						<view class="lefts">
							<view class="avatar">
								<u-avatar :src="item.avatar" shape="circle" default-url="../../../static/default.jpg" size="50" style="border: 4rpx #fff solid;"
									></u-avatar>
							</view>
							<view class="info">
								<view class="name">
									{{item.name}}
								</view>
								<view class="phone">
									{{item.phone}}
								</view>
							</view>
						</view>
						<view class="rights">
							<text>{{item.create_time}}</text>
						</view>
					</view>
					<view class="bottom">
						<view class="item">
							<view class="total">
								<text>{{item.active}}</text>
							</view>
							<view class="title">
								<text>已激活</text>
							</view>
						</view>
						<view class="item">
							<view class="total">
								<text>{{item.unactive}}</text>
							</view>
							<view class="title">
								<text>未激活</text>
							</view>
						</view>
						<view class="item">
							<view class="total">
								<text>{{item.total}}</text>
							</view>
							<view class="title">
								<text>总计</text>
							</view>
						</view>
					</view>
				</view>
			</view>
			<u-empty v-else mode="list" icon="/static/Empty/data_null.png" text="暂无终端">
			</u-empty>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				product_id: null,
				data: []
			}
		},
		onLoad(e) {
			this.product_id = e.id
			this.loadData()
		},
		methods: {
			async loadData() {
				uni.showLoading({
					title: '加载中'
				});
				const {
					data: res
				} = await this.$myHttp({
					url: 'v1/getEquipManageTeam',
					data: {
						product_id: this.product_id
					}
				});
				uni.hideLoading()
				if (res.code == 200) {
					this.data = res.data
				}
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #F2F6FC;
	}
	.all-main {
		.main {
			.list {
				padding: 30rpx;
				
				.items {
					padding: 30rpx;
					box-sizing: border-box;
					background-color: #fff;
					box-shadow: 0 0 16px -14px #333;
					margin-bottom: 30rpx;
					
					.top {
						display: flex;
						justify-content: space-between;
						padding-bottom: 20rpx;
						border-bottom: 1px solid #f4f4f5;
						
						.lefts {
							display: flex;
							
							.info {
								padding-top: 6rpx;
								padding-left: 20rpx;
								
								.name {
									font-weight: bold;
								}
								
								.phone {
									font-size: 26rpx;
									color: #909399;
								}
							}
						}
						
						.rights {
							font-size: 24rpx;
							color: #c8c9cc;
						}
					}
					
					.bottom {
						padding-top: 30rpx;
						display: flex;
						
						.item {
							width: 33.3%;
							align-items: center;
							text-align: center;
							
							.total {
								font-size: 36rpx;
								font-weight: bold;
							}
							
							.title {
								padding-top: 10rpx;
								font-size: 26rpx;
							}
						}
						
						.item:nth-child(1) {
							border-right: 1px solid #f4f4f5;
						}
						.item:nth-child(2) {
							border-right: 1px solid #f4f4f5;
						}
					}
				}
			}
		}
	}
</style>
